// 引入 vue 框架 
import Vue from 'vue'
// 引入 vue-router 路由依赖
import Router from 'vue-router'
// 引入页面组件，命名为 HelloWorld。@代表绝对路径 
import Home from '@/components/Home'
import JsonDemo from '@/components/JsonDemo'
import Login from '@/components/Login'
import Reg from '@/components/Reg'
import My from '@/components/My'
import Order from '@/components/Order'

// Vue 全局使用 Router 
Vue.use(Router)
// 定义路由配置，注意 export 导出，只要道出了别的文件才能 import 导入
export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/',
            name: 'Home',
            component: Home,
            children: [
                {
                    path: '/my',
                    name: 'My',
                    component: My
                },
                {
                    path: '/order',
                    name: 'Order',
                    component: Order
                },
            ]
        },
        {
            path: '/addp',
            name: 'JsonDemo',
            component: JsonDemo
        },
        {
            path: '/login',
            name: 'Login',
            component: Login
        },
        {
            path: '/reg',
            name: 'Reg',
            component: Reg
        },

    ]
})
